package com.colorfruit.admin.control.controller;

import com.colorfruit.admin.business.service.UserService;
import com.colorfruit.framework.model.pojo.BaseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    @Autowired
    HttpServletRequest request;

    @RequestMapping("/getUserInfo")
    public BaseResult getUserInfo(){
        String userId = request.getHeader("userId");
        log.info("# [IN] [controller] deleteProduct param: userId = {}", userId);
        BaseResult baseResult = userService.getUserInfo(userId);
        log.info("# [OUT] [controller] getUserInfo SUCCESS");
        return baseResult;
    }

}
